package com.engine.salary.sys.enums;

import com.engine.salary.enums.BaseEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * 排序规则枚举
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public enum OrderRuleEnum implements BaseEnum<String> {
    DSPORDER("e.dspOrder", "人员显示顺序", 1),
    DEPTSHOWORDER("d.ShowOrder", "部门显示顺序", 1),
    SUBCOMSHOWORDER("c.ShowOrder", "分部显示顺序", 1),
    LASTNAME("e.lastName", "人员名称", 1),
    DEPTNAME("d.departmentname", "部门名称", 1),
    SUBCOMNAME("c.subcompanyname", "分部名称", 1),
    SHOWORDEROFDEPTTREE("d.showOrderOfTree", "组织", 1),
    WORKCODE("e.workcode", "工号", 1);

    private String value;

    private String defaultLabel;

    private int labelId;


    OrderRuleEnum(String value, String defaultLabel, int labelId) {
        this.value = value;
        this.defaultLabel = defaultLabel;
        this.labelId = labelId;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String getDefaultLabel() {
        return defaultLabel;
    }

    @Override
    public Integer getLabelId() {
        return labelId;
    }

    public static OrderRuleEnum parseByValue(String value) {
        for (OrderRuleEnum taxDeclarationFunctionEnum : OrderRuleEnum.values()) {
            if (StringUtils.equals(taxDeclarationFunctionEnum.getValue(), value)) {
                return taxDeclarationFunctionEnum;
            }
        }
        return DSPORDER;
    }
}
